import React from 'react';
import { App } from './01-B站评论列表';

class App2 extends React.Component {
  // 创建组件实例的 ref 属性
  inputRef = React.createRef();
  commentRef = React.createRef();

  render() {
    return (
      <div>
        <input type={'text'} ref={this.inputRef}></input>
        <App ref={this.commentRef} />
        <button
          onClick={() => {
            console.log('click', this.inputRef.current);
            console.log(this.inputRef.current.value);
            console.log(this.commentRef.current.state.list);
          }}
        >
          提交
        </button>
      </div>
    );
  }
}

export default App2;
